package com.atguigu.gmall.list.client;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.list.client.impl.ListDegradeFeignClient;
import com.atguigu.gmall.list.model.SearchParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;

@FeignClient(value = "service-list", path = "/api/list", fallback = ListDegradeFeignClient.class)
public interface ListFeignClient {

    /**
     * 对指定商品分值（热门商品）进行更新
     * 分值
     *
     * @param skuId
     * @param score
     * @return
     */
    @ApiOperation("对指定商品分值（热门商品）进行更新")
    @GetMapping("/inner/incrHotScore/{skuId}/{score}")
    public Result incrHotScore(@PathVariable("skuId") Long skuId, @PathVariable("score") int score);


    /**
     * 商品检索，包含：分页检索商品信息，动态聚合过滤条件。支持多条件过滤
     *
     * @param searchParam
     * @return
     */
    @PostMapping({"/"}) //每个方法调用一个Restful接口
    public Result<Map> search(@RequestBody SearchParam searchParam);
}
